<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:layui=""
      th:replace="pages/common/main :: layout(~{::title}, ~{::section}, ~{}, ~{::script})">
    <head>
        <title>字典</title>
    </head>
    <body>
        <section>

            <div class="layui-fluid">

                <div class="layui-card">
                    <div class="layui-card-body">
                        <table id="area-code-table" lay-filter="area-code-table-filter"></table>
                    </div>
                </div>

            </div>

        </section>

        <script th:inline="javascript">

            layui.use(["grid", "form", "ax", "jquery", "admin"], function () {
                var grid = layui.grid;

                var dicttype = {}
                    , col = [
                    {type: 'numbers'},
                    {field: 'province', align: "center", title: '省份'},
                    {field: 'provinceCode', align: "center", title: '省份ECSS编码'},
                    {field: 'city', align: "center", title: '地市'},
                    {field: 'cityCode', align: "center", title: '地市ECSS编码'},
                    {field: 'area', align: "center", title: '区县'},
                    {field: 'areaCode', align: "center", title: '区县编码'}
                ];

                dicttype.table = {
                    height: "full-98",
                    cols: [col],
                    // url: "",
                    data: /*[[${data}]]*/[],
                    defaultToolbar: ["filter", "print",
                        {
                            "title": "导出Excel",
                            "layEvent": "outputExcel",
                            "icon": "layui-icon-export"
                        }
                    ]
                };

                dicttype.eventOptions = {
                    outputExcel: {
                        url: "/unicomjs/area-code/excel-list",
                        filename: "省市区编码"
                    }
                }

                var options = {
                        tableId: "area-code-table",
                        tableFilter: "area-code-table-filter",
                        table: dicttype.table,
                        eventOptions: dicttype.eventOptions
                    },
                    events = {};

                grid.render(options, events);

            });

        </script>


    </body>
</html>
